package com.tm.chargecar.controller;

import com.tm.chargecar.entity.EvDogcartEntity;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.EvDogcartService;
import com.tm.chargecar.vo.EvDogcartVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 站点管理-电动汽车充电站
 *
 * @author wangJie
 * @create 2022-08-24 9:50
 */

@RestController
@RequestMapping("ev")
public class EvDogcartController {

    @Autowired
    private EvDogcartService evDogcartService;

    /**
     * 查询站点信息//条件查
     *
     * @return
     */
    @GetMapping("queryEv")
    public Result queryEv(@RequestBody EvDogcartVo ev) {


        return evDogcartService.queryEv(ev);
    }

    /**
     * 新增站点
     *
     * @param evDogcartEntity
     * @return
     */
    @PostMapping("insertEv")
    public Result insertEv(@RequestBody EvDogcartEntity evDogcartEntity) {
        evDogcartService.insertEv(evDogcartEntity);
        return Result.SUCCESS();
    }

    /**
     * 修改状态
     * @param evDogcartEntity
     * @return
     */
    @PutMapping("updateState")
    public Result updateState(@RequestBody EvDogcartEntity evDogcartEntity) {
        evDogcartService.updateState(evDogcartEntity);
        return Result.SUCCESS();
    }

    /**
     * 修改全部
     * @param evDogcartEntity
     * @return
     */
    @PutMapping("updateAll")
    public Result updateAll(@RequestBody EvDogcartEntity evDogcartEntity){
        evDogcartService.updateAll(evDogcartEntity);
        return  Result.SUCCESS();
    }

    /**
     * 根据编号联查计费模板
     * @return
     */
    @GetMapping("queryByEvNum")
    public Result queryByEvNum(@RequestBody EvDogcartEntity evDogcartEntity){

        return Result.SUCCESS(evDogcartService.queryByEvNum(evDogcartEntity));
    }
}
